package com.codes.patch;

import java.io.IOException;

import com.codes.patch.file.FileEntry;
import com.codes.patch.utils.PatchGenerator;

public class Main {
	public static void main(String[] args) throws IOException {
		if (args.length < 3) {
			System.out.println("请输入3个参数: 第一个文件名， 第二个文件名， patch文件名");
			return ;
		}
		
		FileEntry oldEntry = new FileEntry(args[0]);
		FileEntry newEntry = new FileEntry(args[1]);
		FileEntry patchEntry = new FileEntry(args[2]);
		
		oldEntry.readFile();
		newEntry.readFile();
		
		PatchGenerator patchGenerator = new PatchGenerator();
		long t = System.currentTimeMillis();
		patchGenerator.makePatch(oldEntry, newEntry, patchEntry);
		
		System.out.println("generate time " + (System.currentTimeMillis() - t) + "ms");
		patchEntry.writeFile();
	}
}
